package com.zmc.lostfound.common.feign;

import com.zmc.lostfound.common.feign.fallback.AuthFallbackFactory;
import com.zmc.lostfound.common.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author ZMC
 * @description Auth用户认证服务远程调用接口
 */
@FeignClient(value = "lostfound-auth", fallbackFactory = AuthFallbackFactory.class)
public interface AuthFeign {

    /**
     * 按用户ids批量查询用户基本信息
     *
     * @param userIds 用户ids
     * @return List<UserBaseInfoDTO> (key = userBaseInfoVOList)
     */
    @PostMapping("/auth/user/query/baseInfoByIds")
    Result queryBaseInfoByIds(@RequestBody List<Long> userIds);

    /**
     * 按用户ids批量查询用户部分信息
     *
     * @param userIds 用户ids
     * @return List<FromUser> (key = fromUserList)
     */
    @PostMapping("/auth/user/query/partInfoByIds")
    Result queryPartInfoByIds(@RequestBody List<Long> userIds);

    /**
     * 按id查询用户详情信息
     *
     * @param id 用户id
     * @return UserDetailInfoDTO (key = userDetailInfoVO)
     */
    @GetMapping("/auth/user/query/detailInfoById/{id}")
    Result queryDetailInfoById(@PathVariable("id") Long id);

    /**
     * 按id查询用户基本信息
     *
     * @param id 用户id
     * @return UserBaseInfoDTO (key = userBaseInfoVO)
     */
    @GetMapping("/auth/user/query/baseInfoById/{id}")
    Result queryBaseInfoById(@PathVariable("id") Long id);

    /**
     * 按id查询用户的角色与权限信息
     *
     * @param id 用户id
     * @return RoleAndPermissionDTO (key = roleAndPermissionDTO)
     */
    @GetMapping("/auth/user/query/roleAndPermission/{id}")
    Result queryRoleAndPermissionById(@PathVariable("id") Long id);

}
